/*
 * @Author: 吕会录 lvhuilu125807@163.com
 * @Date: 2023-08-09 11:31:07
 * @LastEditors: 吕会录 lvhuilu125807@163.com
 * @LastEditTime: 2023-08-18 14:10:59
 * @FilePath: \xyhdp\src\main.js
 * @Description: 
 * Copyright (c) 2023 by ${git_name} email: ${git_email}, All Rights Reserved.
 */
import Vue from 'vue';
import App from './App';
import router from './router';
import VueAMap from 'vue-amap';
import store from './store/';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import VScaleScreen from 'v-scale-screen';
import axios from 'axios';
import websocket from 'vue-native-websocket';


import {
	getFormattedDate
} from './utils/time/times.js'; // 引入 utils.js 中的方法

Vue.prototype.$getFormattedDate = getFormattedDate(); // 将方法添加到 Vue 原型上

import {
	filterType,
	filterDateTime
} from './utils/filters'; // 导入你的全局过滤器方法

Vue.use(VueAMap);

// 全局注册 VScaleScreen 组件
Vue.component('v-scale-screen', VScaleScreen);

VueAMap.initAMapApiLoader({
	// 高德开发者平台申请key值
	key: 'cc9c098d8c07c8fbaed05cc8cca2c71c',
	plugin: ['AMap.Autocomplete', 'AMap.MassMarks', 'AMap.MarkerClusterer', 'AMap.PlaceSearch', 'AMap.Scale',
		'AMap.OverView', 'AMap.ToolBar', 'AMap.mapStyle', 'AMap.PolyEditor', 'AMap.CircleEditor'
	],
	// 默认高德 sdk 版本为 1.4.4
	// v: '2.0.0',
	// theme: 'blue',
	// mapStyle: 'amap://styles/dark', // 替换为你自己的样式ID
});


Vue.config.productionTip = false;

Vue.prototype.$axios = axios;
Vue.prototype.$store = store;
Vue.use(ElementUI);

Vue.use(websocket, '', {
	connectManually: true,
	format: 'json',
	reconnection: true,
	reconnectionAttempts: 5,
	reconnectionDelay: 2000,
});

// 注册全局过滤器
Vue.filter('filterType', filterType);
Vue.filter('filterDateTime', filterDateTime);
Vue.prototype.$getFormattedDate = function() {
	const currentDate = new Date();
	const year = currentDate.getFullYear();
	const month = String(currentDate.getMonth() + 1).padStart(2, '0');
	const day = String(currentDate.getDate()).padStart(2, '0');
	return `${year}-${month}-${day}`;
};
new Vue({
	router,
	render: h => h(App),
}).$mount('#app');